if (do_name() != 'Home') : ?>
Reference | random()
endif ?>
Syntax | random(v1=None, v2=None)
|
Description | Returns a random number that can be assigned to a variable or a parameter. When no parameters are supplied, returns a floating-point (decimal) number between 0.0 and 1.0 (including 0.0 and 1.0). When one parameter is supplied, returns a number between 0 and this parameter. When two parameters are supplied, returns a number between the first and the second parameter. The random() command is useful for all sorts of operations, from random colors to lines with a random width. Note: new random values are returned each time the script runs. The variation can be locked by supplying a custom random seed: from random import seed seed(0) |
Returns | a random number (either an integer or floating-point) within the given boundaries |
Tutorial | Repetition
|
|
Example | r = random() # returns a float between 0 and 1
r = random(2.5) # returns a float between 0 and 2.5
r = random(-1.0, 1.0) # returns a float between -1.0 and 1.0
r = random(5) # returns an int between 0 and 5
r = random(1, 10) # returns an int between 1 and 10
# sets the fill to anything from
# black (0.0,0,0) to red (1.0,0,0)
fill(random(), 0, 0) |
|
include("util/comment.php"); ?>